<nav class="navbar fixed-top navbar-expand-lg navbar-light white scrolling-navbar">
  <div class="container">

    <!-- Brand -->
    <a class="navbar-brand waves-effect" href="/">
      <strong class="blue-text">忧郁小王子</strong>
    </a>

    <!-- Collapse -->
    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
            aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>

    <!-- Links -->
    <div class="collapse navbar-collapse" id="navbarSupportedContent">

      <!-- Left -->
      <ul class="navbar-nav mr-auto">
        <li class="nav-item active">
          <a class="nav-link waves-effect" href="/">首页
          </a>
        </li>

        {{each category}}
        <li class="nav-item">
          <a class="nav-link waves-effect" href="/home/getCategoryArticle?id={{@$value._id}}">{{$value.title}}</a>
        </li>
        {{/each}}
      </ul>
      <ul class="navbar-nav">
        <form action="/home/search" method="post">
        <li class="nav-item">
          <a href="#" class="nav-link border border-light rounded waves-effect">
            <input name="key" id="searchValue" type="text" placeholder="请输入搜索内容">
            <button type="submit" id="search"><i class="fa fa-search fa-lg"></i></button>
          </a>
        </li>
        </form>
      </ul>
      <!-- Right -->
      <ul class="navbar-nav nav-flex-icons">
        {{if userInfo != null && userInfo.role == '管理员'}}
        <li class="nav-item">
          <a href="#" class="nav-link waves-effect" >
            欢迎你:{{userInfo.username}}
          </a>
        </li>
        <li class="nav-item">
          <a href="/admin/index" class="nav-link waves-effect" >
            进入后台
          </a>
        </li>
        <li class="nav-item">
          <a href="/logout" class="nav-link waves-effect" >
            退出
          </a>
        </li>
        {{else if userInfo != null && userInfo.role == '用户'}}
        <li class="nav-item">
          <a href="#" class="nav-link waves-effect" >
            欢迎你:{{userInfo.username}}
          </a>
        </li>
        <li class="nav-item">
          <a href="/logout" class="nav-link waves-effect" >
            退出
          </a>
        </li>
        {{else}}
        <li class="nav-item">
          <a href="/toLoginPage" class="nav-link waves-effect" >
            登录
          </a>
        </li>
        <li class="nav-item">
          <a href="#" class="nav-link waves-effect" >
            注册
          </a>
        </li>
        {{/if}}

      </ul>
    </div>

  </div>
</nav>
<script>
</script>